public class ctrl_pdfAndProcessSelectionClass
{
    //For Variables...
    public List<String> commanPDFcheckedList{get;set;}
    public boolean commanPdfGenerationFlag{get;set;}
    public List<String> tenancyContractPDFcheckedList{get;set;}
    public List<String> tenancyContractLocationTypeList {get;set;}
    public boolean tenancyPdfGenerationFlag{get;set;} 
    public Boolean residencyVisaLeftZeroFlag {get;set;}
    public Boolean residencyVisaLeftLessThanZeroFlag {get;set;}
    public Boolean applicationRecordTypeFlag {get;set;}
    
    public string accountID {get;set;}
    
    public string redirectURLLink{get;set;}
    public string processSelectionString {get;set;}
    public boolean redirectURLLinkFlag {get;set;}
    public Account accountObject = null;
    
    public string applicationRecordTypeId {get;set;}
    
    //For Constructors...
    public ctrl_pdfAndProcessSelectionClass(ApexPages.StandardController controller) 
    {
        //Initialize the Variables...
        commanPDFcheckedList = new List<string>();
        commanPdfGenerationFlag = false;
        tenancyContractPDFcheckedList = new List<String>();
        tenancyPdfGenerationFlag = false; 
        tenancyContractLocationTypeList = new List<string>();
        processSelectionString = null;
        redirectURLLink = null;
        redirectURLLinkFlag = false;
        applicationRecordTypeFlag = false;
            
        //For Account ID...
        accountID = ApexPages.CurrentPage().getParameters().get('Id');
        
        if(accountID != null)
        {
            accountObject = [select id,OwnerId,Login_User_Id__c,Renew_Additional_Type__c,RecordTypeId,Number_Of_Tenancy_Contract_Renwal__c,Name,License_Application_Step__c,Residence_Visa_Quota_Left_2__c,Supended_Approved_suspentions_No__c, Number_Of_Approved_Suspension_Record__c, Login_User_Profile__c from Account where id =: accountID];
            
        }
    }
    
    //For Methods...
    
    
    //For Application and Tracking User Page Display...
    public PageReference displayMessagePanel()
    {
        if(accountID != null)
        {
            if(processSelectionString == 'Application')
            {
                if(accountObject.Residence_Visa_Quota_Left_2__c == 0)
                    residencyVisaLeftZeroFlag = true;
                else if(accountObject.Residence_Visa_Quota_Left_2__c < 0)
                    residencyVisaLeftLessThanZeroFlag = true;   
                else 
                    applicationRecordTypeFlag = true;    
            }
            else
            {
                residencyVisaLeftZeroFlag = false;
                residencyVisaLeftLessThanZeroFlag = false;  
            }
            System.debug('residencyVisaLeftZeroFlag => '+ residencyVisaLeftZeroFlag);
            System.debug('residencyVisaLeftLessThanZeroFlag => '+ residencyVisaLeftLessThanZeroFlag);   
        }
        
        //return the values...
        return null;
    }
    
    //For Process's Page...
    public PageReference processesProceedButton()
    {
        try
        {
            
            if(accountObject != null)
            {
                
                System.debug('The Process Selection String => ' + processSelectionString );
                if(processSelectionString != null)
                {   
                    if(processSelectionString == 'Application')
                    {
                        System.debug('The Application Record Type Selection => '+ applicationRecordTypeId);
                        
                        //For Redirection to the Application Record Type Page...
                        //redirectURLLink = 'setup/ui/recordtypeselect.jsp?ent=01I30000001aAfz&retURL=%2F'+ accountID +'&save_new_url=%2Fa0E%2Fe%3FCF00N30000006q4td%3DTesting%2BFor%2BCC%2BGeneral%2BTrading%26CF00N30000006q4td_lkid%3D'+ accountID +'%26retURL%3D%252F'+ accountID;
                        
                        //For Embedding the Application Record Type in salesforce...
                        redirectURLLink = Schema.getGlobalDescribe().get('Application__c').getDescribe().getKeyPrefix()+ '/e?CF00N30000006q4td='+ string.escapeSingleQuotes(accountObject.Name)+'&&CF00N30000006q4td_lkid='+ accountID +'&retURL=%2F'+ accountID + '&RecordType='+ applicationRecordTypeId;
                        redirectURLLinkFlag = true;
                        
                    }
                    else if(processSelectionString == 'Tracking')
                    {
                        redirectURLLink = Schema.getGlobalDescribe().get('Tracking__c').getDescribe().getKeyPrefix()+ '/e?CF00N30000007rVKq='+ string.escapeSingleQuotes(accountObject.Name)+'&CF00N30000007rVKq_lkid='+ accountID +'&retURL=%2F'+ accountID;
                        redirectURLLinkFlag = true;
                        
                        
                    }
                    else if(processSelectionString == 'Amendment')
                    {
                        //We already Seggregate values based on the Amendment...
                        redirectURLLink = 'apex/apex/vfp_Amendment_Selection?accountId='+ accountID;
                        redirectURLLinkFlag = true;
                            
                    }
                    else if(processSelectionString == 'CancelLicense')
                    {
                        
                        string result = buttonExecutionClass.cancelLicenseMethod(accountID);
                        
                        if(result == 'Success')
                        {
                            //For returning the values...
                            PageReference pageRef = new PageReference('/'+accountID);
                            return pageRef; 
                        }
                        else
                        {
                            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'The Error => '+ result);
                            ApexPages.addMessage(msg);
                            return null;
                        }
                        
                    }
                    else if(processSelectionString == 'RenewalLicenseChangeLocation')
                    {
                        if(accountObject.Number_Of_Tenancy_Contract_Renwal__c == 0)
                        {
                            List<Tenancy_Contract__c> tenancyContractList = new List<Tenancy_Contract__c>([Select Tenancy_Contract_Expiry_Date__c,Tenancy_Contract_Renewal_Steps__c,Renewal_Start_Date__c,Record_Type_Name__c,Account_Tenancy_Expriy_Difference__c, Name, Location__c, Contract_Status__c,Location__r.Current_Tenancy_Contract__c, Id From Tenancy_Contract__c where ((Tenancy_Contract_Cancellation_Date__c =: null) AND (Tenant__c =: accountId))]);  
                            
                            //For Tenancy Contract Searching....    
                            /*Map<ID,ID> locationTennacyContractMap = new Map<ID,ID>();
                            for(Tenancy_Contract__c tenancyObject : tenancyContractList )
                            {
                                locationTennacyContractMap.put(tenancyObject.Id,tenancyObject.Location__c);
                            }
                            
                            if(locationTennacyContractMap.size() > 0 )*/
                            if(tenancyContractList.size() > 0 )
                            {
                                //Now Checking the All the Locations Related to the account...
                                //List<Location__c> locationObjectList = new list<Location__c>([select Id,Current_Tenancy_Contract__c,name from Location__c where Current_Tenancy_Contract__c =: locationTennacyContractMap.keyset()]);
                                List<Account_Location__c> accountLocationInsertList = new List<Account_Location__c>();
                                RecordType recordType  = null;
                                recordType = [select id,SObjectType,IsActive,DeveloperName FROM RecordType where SObjectType =: 'Account' AND IsActive =: true AND DeveloperName =: 'Renewal_Additional_Front_Office'];
                                
                                if(recordType != null)
                                {
                                    //For Copied all the Tenancy Contract in Account Locations Fields...
                                    for(Tenancy_Contract__c tenancyObject :tenancyContractList )
                                    {
                                        //if(tenancyObject.Location__r.Current_Tenancy_Contract__c != null)
                                        //{
                                            Account_Location__c accountLocationObject = new Account_Location__c();
                                            accountLocationObject.Account__c = accountObject.Id;
                                            accountLocationObject.Previous_Location__c = tenancyObject.Location__c;
                                            accountLocationObject.Previous_Tenancy_Contract__c = tenancyObject.Id;
                                            accountLocationObject.renewChangeLocationFlag_InTenancy_Object__c = true;
                                            
                                            //Adding in the List to insert...
                                            accountLocationInsertList.add(accountLocationObject);   
                                        
                                        //} 
                                        
                                    }
                                    
                                    
                                    
                                    //Now Insert the Account Locations...
                                    if(accountLocationInsertList.size() > 0)
                                    {
                                        insert accountLocationInsertList;
                                        
                                        accountObject.RecordTypeId = recordType.Id;
                                        accountObject.License_Application_Step__c = 'Renew License with Change Location Started';
                                        //accountObject.License_Application_Type__c = 'Renewal Additional';
                                        accountObject.License_Application_Type__c = 'Renewal Amendment';
                                        accountObject.Renew_Additional_Type__c = 'Renew With Change Location';
                                        accountObject.Record_Approver_Id__c = accountObject.Login_User_Id__c;
                                        accountObject.OwnerId = accountObject.Login_User_Id__c;
                                        //Now Update the Account Record...
                                        update accountObject;
                                        
                                        integer slaHours = 0;
                                        boolean slaFlag = false;
                                        
                                        for(SLA_Custom_Setting__c slaRecord : SLA_Custom_Setting__c.getAll().values())
                                        {
                                            if(slaRecord.Application_Type__c == 'Renewal Amendment - Change Location' && slaRecord.Process_Type__c == 'License')
                                            {
                                                slaHours = integer.valueof(slaRecord.SLA_Hours__c);
                                                slaFlag  = true;
                                                break;
                                            }
                                                                    
                                        }
                                        
                                        if(slaFlag)
                                        {
                                            // Assumes the BSC work hours are the default for the Org
                                            List<BusinessHours> businessHoursObjectList = new List<BusinessHours>([select id from businesshours where isDefault = true LIMIT 1]) ;
                                
                                            if(businessHoursObjectList.size() > 0)
                                            {
                                                SLA__c slaObject = new SLA__c();
                                                slaObject.SLA_Hours__c = slaHours ;
                                                slaObject.Actual_Start_Date_Time__c = DateTime.Now();
                                                // BSC works 11.5 hours / day (8:00 AM - 7:30 PM, M-F). Our SLA is 2-days (23 business hours)
                                                System.debug('The Actual Start Time => '+ slaObject.Actual_Start_Date_Time__c );
                                                System.debug('The Expected End Date => '+ slaObject.Actual_Start_Date_Time__c.addhours(slaHours));
                                                System.debug('The Business Hour Date => ' + BusinessHours.add(businessHoursObjectList[0].id, slaObject.Actual_Start_Date_Time__c, slaHours * 60 * 60 * 1000L));
                                                System.debug('The Business Hour Date GMT => ' + BusinessHours.addGmt(businessHoursObjectList[0].id, slaObject.Actual_Start_Date_Time__c, slaHours * 60 * 60 * 1000L));
                                                slaObject.Expected_End_Date__c = BusinessHours.addGmt(businessHoursObjectList[0].id, slaObject.Actual_Start_Date_Time__c, slaHours * 60 * 60 * 1000L); 
                                                //slaObject.Expected_End_Date__c = DateTime.Now().addhours(slaHours);
                                                slaObject.License__c = accountObject.Id ;
                                                slaObject.Application_Type__c = 'Renewal Amendment - Change Location' ;
                                                slaObject.Process_Type__c = 'License';
                                                
                                                //Adding in the List...
                                                upsert slaObject;
                                            }                                                    
                                        }
                                
                                        //For returning the values...
                                        PageReference pageRef = new PageReference('/'+accountID);
                                        return pageRef; 
                                    }
                                    else
                                    {
                                        
                                        
                                        
                                        
                                    }
                                        
                                }
                                
                                
                            }
                            else
                            {
                                ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'There is no Active Tenancy Contract associated with this Account...');
                                ApexPages.addMessage(msg);
                                return null;
                            }
                            
                        }
                        else
                        {               
                            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'One of the Tenancy Contract still in the process of Renewal, Please first renewed that Tenancy Contract');
                            ApexPages.addMessage(msg);
                            return null;
                        }
                        /*if(accountObject.Number_Of_Tenancy_Contract_Renwal__c == 0)
                        {
                            List<Tenancy_Contract__c> tenancyContractList = new List<Tenancy_Contract__c>([Select Tenancy_Contract_Expiry_Date__c,Tenancy_Contract_Renewal_Steps__c,Renewal_Start_Date__c,Record_Type_Name__c,Account_Tenancy_Expriy_Difference__c, Name, Location__c, Contract_Status__c, Id From Tenancy_Contract__c where ((Tenancy_Contract_Cancellation_Date__c =: null) AND (Tenant__c =: accountId))]);  
                            //For Tenancy Contract Searching....    
                            Map<ID,ID> locationTennacyContractMap = new Map<ID,ID>();
                            for(Tenancy_Contract__c tenancyObject : tenancyContractList )
                            {
                                locationTennacyContractMap.put(tenancyObject.Id,tenancyObject.Location__c);
                            }
                            
                            if(locationTennacyContractMap.size() > 0 )
                            {
                                //Now Checking the All the Locations Related to the account...
                                List<Location__c> locationObjectList = new list<Location__c>([select Id,Current_Tenancy_Contract__c,name from Location__c where Current_Tenancy_Contract__c =: locationTennacyContractMap.keyset()]);
                                
                                //If the size is not equal to the tenancyObject then it is error...
                                if(locationObjectList.size() == locationTennacyContractMap.size())
                                {  
                                    Boolean isContinueRenewal = true;
                                
                                    //Now Check the tenancy Contract Expired Comparison....
                                    for(Tenancy_Contract__c tenancyObject :tenancyContractList )
                                    {
                                        if((tenancyObject.Tenancy_Contract_Expiry_Date__c < System.Today() ) && ((tenancyObject.Account_Tenancy_Expriy_Difference__c) > integer.valueof(30)))
                                        {
                                            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'Please perform the Tenancy Contract Renewal for Tenancy contract of "'+ tenancyObject.Name +'"');
                                            ApexPages.addMessage(msg);
                                            
                                            isContinueRenewal = false;
                                            
                                            return null;
                                            
                                        }
                                    }
                                    
                                    if(isContinueRenewal)
                                    {
                                        RecordType recordType  = null;
                                        recordType = [select id,SObjectType,IsActive,DeveloperName FROM RecordType where SObjectType =: 'Account' AND IsActive =: true AND DeveloperName =: 'Renewal_Additional_Front_Office'];
                                        
                                        if(recordType != null)
                                        {
                                            List<Account_Location__c> accountLocationInsertList = new List<Account_Location__c>();
                                            //For Copied all the Tenancy Contract in Account Locations Fields...
                                            for(Tenancy_Contract__c tenancyObject :tenancyContractList )
                                            {
                                                Account_Location__c accountLocationObject = new Account_Location__c();
                                                accountLocationObject.Account__c = accountObject.Id;
                                                accountLocationObject.Previous_Location__c = tenancyObject.Location__c;
                                                accountLocationObject.Previous_Tenancy_Contract__c = tenancyObject.Id;
                                                accountLocationObject.renewChangeLocationFlag_InTenancy_Object__c = true;
                                                
                                                //Adding in the List to insert...
                                                accountLocationInsertList.add(accountLocationObject);
                                                
                                            }
                                            
                                            
                                            
                                            accountObject.RecordTypeId = recordType.Id;
                                            accountObject.License_Application_Step__c = 'Renew License with Change Location Started';
                                            //accountObject.License_Application_Type__c = 'Renewal Additional';
                                            accountObject.License_Application_Type__c = 'Renewal Amendment';
                                            accountObject.Renew_Additional_Type__c = 'Renew With Change Location';
                                            //Now Update the Account Record...
                                            update accountObject;
                                            
                                            //Now Insert the Account Locations...
                                            if(accountLocationInsertList.size() > 0)
                                                insert accountLocationInsertList;
                                            
                                                        
                                            //For returning the values...
                                            PageReference pageRef = new PageReference('/'+accountID);
                                            return pageRef; 
                                        }
                                    }
                                        
                                }    
                                else
                                {
                                    ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'Please review the Tenancy Contracts, One of the Location is no more associated to the tenancy Contract');
                                    ApexPages.addMessage(msg);
                                    return null;
                                }
                                        
                            }
                            else
                            {
                                ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'There is no Active Tenancy Contract associated with this Account...');
                                ApexPages.addMessage(msg);
                                return null;
                            }
                          
                        }
                        else
                        {               
                            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'One of the Tenancy Contract still in the process of Renewal, Please first renewed that Tenancy Contract');
                            ApexPages.addMessage(msg);
                            return null;
                        }
                        */
                        
                        
                        
                    }
                    
                    else if(processSelectionString == 'RenewalLicenseAddLocation')
                    {
                        
                        RecordType recordType  = null;
                        recordType = [select id,SObjectType,IsActive,DeveloperName FROM RecordType where SObjectType =: 'Account' AND IsActive =: true AND DeveloperName =: 'Renewal_Additional_Front_Office'];
                        List<Tenancy_Contract__c> tenancyContractList = new List<Tenancy_Contract__c>([Select Tenancy_Contract_Expiry_Date__c,Tenancy_Contract_Renewal_Steps__c,Renewal_Start_Date__c,Record_Type_Name__c,Account_Tenancy_Expriy_Difference__c, Name, Location__c, Contract_Status__c,Location__r.Current_Tenancy_Contract__c, Id From Tenancy_Contract__c where ((Tenancy_Contract_Cancellation_Date__c =: null) AND (Tenant__c =: accountId))]);  
                            
                        if(recordType != null)
                        {
                            List<Account_Location__c> accountLocationInsertList = new List<Account_Location__c>();
                            //For Copied all the Tenancy Contract in Account Locations Fields...
                            for(Tenancy_Contract__c tenancyObject :tenancyContractList )
                            {
                                //if(tenancyObject.Location__r.Current_Tenancy_Contract__c != null)
                                //{
                                    Account_Location__c accountLocationObject = new Account_Location__c();
                                    accountLocationObject.Account__c = accountObject.Id;
                                    accountLocationObject.Previous_Location__c = tenancyObject.Location__c;
                                    accountLocationObject.Previous_Tenancy_Contract__c = tenancyObject.Id;
                                    accountLocationObject.renewAddLocationFlag__c = true;
                                    //Adding in the List to insert...
                                    accountLocationInsertList.add(accountLocationObject);   
                                //}
                                
                                
                            }
                            
                            
                            //Now Insert the Account Locations...
                            if(accountLocationInsertList.size() > 0)
                            {
                                insert accountLocationInsertList;
                                    
                                accountObject.RecordTypeId = recordType.Id;
                                accountObject.License_Application_Step__c = 'Renew License with Add Location Started';
                                //accountObject.License_Application_Type__c = 'Renewal Additional';
                                accountObject.License_Application_Type__c = 'Renewal Amendment';
                                accountObject.Renew_Additional_Type__c = 'Renew With Add Location';
                                accountObject.Record_Approver_Id__c = accountObject.Login_User_Id__c;
                                accountObject.OwnerId = accountObject.Login_User_Id__c;
                                //Now Update the Account Record...
                                update accountObject;
                                
                                integer slaHours = 0;
                                boolean slaFlag = false;
                                
                                for(SLA_Custom_Setting__c slaRecord : SLA_Custom_Setting__c.getAll().values())
                                {
                                    if(slaRecord.Application_Type__c == 'Renewal Amendment - Add Location' && slaRecord.Process_Type__c == 'License')
                                    {
                                        slaHours = integer.valueof(slaRecord.SLA_Hours__c);
                                        slaFlag  = true;
                                        break;
                                    }
                                                            
                                }
                                
                                if(slaFlag)
                                {
                                    // Assumes the BSC work hours are the default for the Org
                                    List<BusinessHours> businessHoursObjectList = new List<BusinessHours>([select id from businesshours where isDefault = true LIMIT 1]) ;
                        
                                    if(businessHoursObjectList.size() > 0)
                                    {
                                        SLA__c slaObject = new SLA__c();
                                        slaObject.SLA_Hours__c = slaHours ;
                                        slaObject.Actual_Start_Date_Time__c = DateTime.Now();
                                        // BSC works 11.5 hours / day (8:00 AM - 7:30 PM, M-F). Our SLA is 2-days (23 business hours)
                                        System.debug('The Actual Start Time => '+ slaObject.Actual_Start_Date_Time__c );
                                        System.debug('The Expected End Date => '+ slaObject.Actual_Start_Date_Time__c.addhours(slaHours));
                                        System.debug('The Business Hour Date => ' + BusinessHours.add(businessHoursObjectList[0].id, slaObject.Actual_Start_Date_Time__c, slaHours * 60 * 60 * 1000L));
                                        System.debug('The Business Hour Date GMT => ' + BusinessHours.addGmt(businessHoursObjectList[0].id, slaObject.Actual_Start_Date_Time__c, slaHours * 60 * 60 * 1000L));
                                        slaObject.Expected_End_Date__c = BusinessHours.addGmt(businessHoursObjectList[0].id, slaObject.Actual_Start_Date_Time__c, slaHours * 60 * 60 * 1000L); 
                                        //slaObject.Expected_End_Date__c = DateTime.Now().addhours(slaHours);
                                        slaObject.Application_Type__c = 'Renewal Amendment - Add Location';
                                        slaObject.Process_Type__c = 'License';
                                        slaObject.License__c = accountObject.Id ;
                                        
                                        //Adding in the List...
                                        upsert slaObject;
                                    }                                       
                                }
                                
                                
                                //For returning the values...
                                PageReference pageRef = new PageReference('/'+accountID);
                                return pageRef;
                                
                            }
                                 
                        }
                        
                    }
                    
                }
                else
                {
                    ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'Please select atleast one Process');
                    ApexPages.addMessage(msg);
                    return null;
                    
                }   
            }
            
        }
        catch(Exception exp)
        {
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'The Error => '+ exp.getMessage());
            ApexPages.addMessage(msg);
            return null;
        }
        
        //Returning the values...
        return null;
    }
    
    
    //For PDF's...
    public PageReference pdfProceedButton()
    {
        
        if(commanPDFcheckedList.size() > 0 || tenancyContractPDFcheckedList.size() > 0)
        {
            if(commanPDFcheckedList.size() > 0)
                commanPdfGenerationFlag = true;
                
            if(tenancyContractPDFcheckedList.size() > 0)    
                tenancyPdfGenerationFlag = true;
                
            /*for(String tempString : commanPDFcheckedList)
            {
                System.debug('The Temporary String => '+ tempString);
            }*/
            
            //System.debug('The Comman PDF Generation Flag => '+ commanPdfGenerationFlag);
        }   
        else
        {
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, 'Please Select atleast one of the PDF\'s ');
            ApexPages.addMessage(msg);
            return null;
            
        }   
        //Returning the values...
        return null;
    }
    
    //For Cancel Button...
    public PageReference cancelButton()
    { 
        //Pagereference pageRef = new PageReference('/'+ApexPages.CurrentPage().getParameters().get('Id'));
        Pagereference pageRef = new PageReference('/'+ accountID);
        return pageRef;
    }
    
    //For Tenancy Contract PDF Properties....
    public List<SelectOption> getTenancyContractPdfCheckList() 
    {
        List<SelectOption> options = new List<SelectOption>();
        
        //For Tenancy Contract...       
        for(Tenancy_Contract__c tenancyObject : [Select Tenancy_Contract_Expiry_Date__c,Tenancy_Contract_Renewal_Steps__c,Renewal_Start_Date__c,Record_Type_Name__c,Account_Tenancy_Expriy_Difference__c, Name, Location__c,Location__r.Location_Type__c, Contract_Status__c, Id From Tenancy_Contract__c where ((Tenancy_Contract_Cancellation_Date__c =: null) AND (Tenant__c =: accountID)) LIMIT 1000])
        {
            options.add(new SelectOption(tenancyObject.Id,tenancyObject.Name));
            tenancyContractLocationTypeList.add(tenancyObject.Location__r.Location_Type__c);
            
        }
        
        return options;
    }
    
    //For Comman PDF Properties....
    public List<SelectOption> getcommanPdfCheckList() 
    {
        List<SelectOption> options = new List<SelectOption>();
        
        options.add(new SelectOption('vfp_GenerateLicense','License Form'));
        options.add(new SelectOption('vfp_ArticlesOfActivities','Share-Ownership Form'));
        options.add(new SelectOption('vfp_GenerateChamberForm','Chamber Form'));
        options.add(new SelectOption('vfp_WelcomeSawahi','Sawahi Service'));                
        //now return the values...
        return options;
    }
    
    //For Processes Properties....
    public List<SelectOption> getprocessesCheckList() 
    {
        List<SelectOption> options = new List<SelectOption>();
        if(accountObject.Login_User_Profile__c == 'SmartPaper BPM: 08 License - Front Office Payment User' || accountObject.Login_User_Profile__c == 'SmartPaper BPM: 01 Front Office User' || accountObject.Login_User_Profile__c == 'SmartPaper BPM: 09 License - Marketing Staff' ||accountObject.Login_User_Profile__c == 'System Administrator')   
        {
            if(accountObject.Login_User_Profile__c == 'SmartPaper BPM: 09 License - Marketing Staff')
            {
                if(accountObject.License_Application_Step__c == 'Archived')
                {
                    options.add(new SelectOption('RenewalLicenseAddLocation','Renewal License + Add Location'));
                    options.add(new SelectOption('RenewalLicenseChangeLocation','Renewal License + Change Location'));
                    options.add(new SelectOption('Amendment','Amendment Process')); 
                }
                
            }
            else 
            {
                options.add(new SelectOption('Application','Application Process'));
                options.add(new SelectOption('Tracking','Tracking Process'));
                //For Archived Applications...
                if(accountObject.License_Application_Step__c == 'Archived')
                {
                    if(accountObject.Login_User_Profile__c == 'System Administrator')
                    {
                        options.add(new SelectOption('RenewalLicenseAddLocation','Renewal License + Add Location'));
                        options.add(new SelectOption('RenewalLicenseChangeLocation','Renewal License + Change Location'));
                            
                    }
                    
                    options.add(new SelectOption('Amendment','Amendment Process'));
                    options.add(new SelectOption('CancelLicense','Cancel License Process'));
                
                }               
                
                
            }
                        
        }
        else
        {
            options.add(new SelectOption('Tracking','Tracking Process'));
        
        }
        
        //Available for all the Profiles...
        
        
        //now return the values...
        return options;
    }
    
    //For Applications...
    public List<SelectOption> getApplicationRecordTypeOptions()
    {
        //RecordType applicationRecordType = null;
        //applicationRecordType = [SELECT id,SObjectType,IsActive,DeveloperName,Name FROM RecordType where SObjectType =: 'Employment' AND isActive =: true];
        List<SelectOption> options = new List<SelectOption>();
        
        for(RecordType applicationRecordType : [SELECT id,SObjectType,IsActive,DeveloperName,Name FROM RecordType where SObjectType =: 'Application__c' AND IsActive =: true])
        {
            
            System.debug('The Application Record Type Visa => '+ accountObject.Residence_Visa_Quota_Left_2__c);
            
            if(accountObject.Residence_Visa_Quota_Left_2__c == 0 )
            {
                System.debug('The Application Record Type Developer Name => '+ applicationRecordType.DeveloperName);
                if(applicationRecordType.DeveloperName != 'Employment')
                {
                    System.debug('The Option');
                    options.add(new SelectOption(applicationRecordType.id,applicationRecordType.Name));     
                }
                
            }
            else if(accountObject.Residence_Visa_Quota_Left_2__c < 0)
            {
                if(applicationRecordType.DeveloperName != 'Employment' && applicationRecordType.DeveloperName != 'Residency')
                {
                    System.debug('The Option');
                    options.add(new SelectOption(applicationRecordType.id,applicationRecordType.Name));     
                }
            }
            else 
            {
                options.add(new SelectOption(applicationRecordType.id,applicationRecordType.Name)); 
                System.debug('The Application Record Type Developer Name Else => '+ applicationRecordType.DeveloperName);
            }
            
            
        }
        
        //now return the values...
        return options;
        
                
    }
    
    
    
}